package org.snake.demo.mvc.action;

import org.snake.demo.service.IQueryService;
import org.snake.mvcframework.annotation.RAYAutowired;
import org.snake.mvcframework.annotation.RAYController;
import org.snake.mvcframework.annotation.RAYRequestMapping;
import org.snake.mvcframework.annotation.RAYRequestParam;
import org.snake.spring.framework.webmvc.servlet.RAYModelAndView;

import java.util.HashMap;
import java.util.Map;

/**
 * 公布接口url
 *
 * @author Tom
 */
@RAYController
@RAYRequestMapping("/")
public class PageAction
{

    @RAYAutowired
    private IQueryService queryService;

    @RAYRequestMapping("/first.html")
    public RAYModelAndView query(@RAYRequestParam("teacher") String teacher)
    {

        String result = queryService.query(teacher);
        Map<String, Object> model = new HashMap<String, Object>();
        model.put("teacher", teacher);
        model.put("data", result);
        model.put("token", "123456");
        return new RAYModelAndView("first.html", model);
    }

}
